<template>
  <div class="consultChart2"></div>
</template>

<script>
import * as echarts from "echarts";
export default {
  props: ["chart2List"],
  data() {
    return {
      chart: null,
    };
  },
  mounted() {
    setTimeout(() => {
      this.initChart();
    },1000)
  },
  methods: {
    initChart() {
      var myCharts = document.querySelector(".consultChart2");
      this.chart = echarts.init(myCharts);
      var option = {
        title: {
          text: "不同危机等级人才占比",

          left: "center",
        },
        tooltip: {
          trigger: "item",
          formatter: "{b} : {c} ({d}%)",
        },
        legend: {
          orient: "vertical",
          left: "left",
        },
        series: [
          {
            // name: "Access From",
            type: "pie",
            radius: "50%",
            data: this.chart2List,
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
            },
          },
        ],
      };
      this.chart.setOption(option);
    },
  },
};
</script>

<style scoped>
.consultChart2 {
  width: 100%;
  height: 25rem;
  margin: 2rem 0;
}
</style>